#include "ssas_api.h"
#include "log_api.h"
#include <stdlib.h>

int signalMappingInstance[] = {
    0,  //COM_SID_LftTrnLmpAtv
    0,  //COM_SID_RtTrnLmpAtv
    0,
    0,
    0,
    0,
    0,
    0,
    0,
};

SignalMapping mock_signals = {
    signalMappingInstance,
    sizeof(signalMappingInstance)/sizeof(signalMappingInstance[0]),
};

int Com_ReceiveSignal(int sigId, void* value)
{
    
    if(sigId >= mock_signals.size_)
    {
        LOG_E("Com_ReceiveSignal Invaild sigId:%d\n", sigId);
        abort();
        return 1;
    }
    else
    {
        *(short*)value = mock_signals.signalIds_[sigId];
        return 0;
    }
}

void mock_SendSIgnal(int sigId, int value)
{
    if(sigId >= mock_signals.size_)
    {
        LOG_E("mock_SendSIgnal Invaild sigId:%d\n", sigId);
        abort();
    }
    else
    {
        mock_signals.signalIds_[sigId] = value;
    }
    signalMappingInstance[sigId] = value;
}

VeclKeyStatus g_acc = ACC_OFF;

VeclKeyStatus getAccState()
{
    return g_acc;
}

void setAccState(VeclKeyStatus st)
{
    g_acc = st;
}

int g_speed = 0;
int getDisplaySpeed()
{
    return g_speed;
}

void setDisplaySpeed(int speed)
{
    g_speed = speed;
}